<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * XistsUser filter form base class.
 *
 * @package    xists
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseXistsUserFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'username'             => new sfWidgetFormFilterInput(),
      'first_name'           => new sfWidgetFormFilterInput(),
      'last_name'            => new sfWidgetFormFilterInput(),
      'gender'               => new sfWidgetFormFilterInput(),
      'email'                => new sfWidgetFormFilterInput(),
      'passwd'               => new sfWidgetFormFilterInput(),
      'dob'                  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'address1'             => new sfWidgetFormFilterInput(),
      'address2'             => new sfWidgetFormFilterInput(),
      'city'                 => new sfWidgetFormFilterInput(),
      'state'                => new sfWidgetFormFilterInput(),
      'country_id'           => new sfWidgetFormPropelChoice(array('model' => 'XistsCountry', 'add_empty' => true)),
      'zipcode'              => new sfWidgetFormFilterInput(),
      'mobile'               => new sfWidgetFormFilterInput(),
      'passport_no'          => new sfWidgetFormFilterInput(),
      'security_question'    => new sfWidgetFormFilterInput(),
      'security_answer'      => new sfWidgetFormFilterInput(),
      'ref_username'         => new sfWidgetFormFilterInput(),
      'place_under_username' => new sfWidgetFormFilterInput(),
      'join_position'        => new sfWidgetFormFilterInput(),
      'plan_id'              => new sfWidgetFormPropelChoice(array('model' => 'XistsPlan', 'add_empty' => true)),
      'deposit_amount'       => new sfWidgetFormFilterInput(),
      'is_activated'         => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'join_date'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'plan_expires_at'      => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'created_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'updated_at'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
    ));

    $this->setValidators(array(
      'username'             => new sfValidatorPass(array('required' => false)),
      'first_name'           => new sfValidatorPass(array('required' => false)),
      'last_name'            => new sfValidatorPass(array('required' => false)),
      'gender'               => new sfValidatorPass(array('required' => false)),
      'email'                => new sfValidatorPass(array('required' => false)),
      'passwd'               => new sfValidatorPass(array('required' => false)),
      'dob'                  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'address1'             => new sfValidatorPass(array('required' => false)),
      'address2'             => new sfValidatorPass(array('required' => false)),
      'city'                 => new sfValidatorPass(array('required' => false)),
      'state'                => new sfValidatorPass(array('required' => false)),
      'country_id'           => new sfValidatorPropelChoice(array('required' => false, 'model' => 'XistsCountry', 'column' => 'id')),
      'zipcode'              => new sfValidatorPass(array('required' => false)),
      'mobile'               => new sfValidatorPass(array('required' => false)),
      'passport_no'          => new sfValidatorPass(array('required' => false)),
      'security_question'    => new sfValidatorPass(array('required' => false)),
      'security_answer'      => new sfValidatorPass(array('required' => false)),
      'ref_username'         => new sfValidatorPass(array('required' => false)),
      'place_under_username' => new sfValidatorPass(array('required' => false)),
      'join_position'        => new sfValidatorPass(array('required' => false)),
      'plan_id'              => new sfValidatorPropelChoice(array('required' => false, 'model' => 'XistsPlan', 'column' => 'id')),
      'deposit_amount'       => new sfValidatorSchemaFilter('text', new sfValidatorNumber(array('required' => false))),
      'is_activated'         => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'join_date'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'plan_expires_at'      => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'created_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('xists_user_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'XistsUser';
  }

  public function getFields()
  {
    return array(
      'id'                   => 'Number',
      'username'             => 'Text',
      'first_name'           => 'Text',
      'last_name'            => 'Text',
      'gender'               => 'Text',
      'email'                => 'Text',
      'passwd'               => 'Text',
      'dob'                  => 'Date',
      'address1'             => 'Text',
      'address2'             => 'Text',
      'city'                 => 'Text',
      'state'                => 'Text',
      'country_id'           => 'ForeignKey',
      'zipcode'              => 'Text',
      'mobile'               => 'Text',
      'passport_no'          => 'Text',
      'security_question'    => 'Text',
      'security_answer'      => 'Text',
      'ref_username'         => 'Text',
      'place_under_username' => 'Text',
      'join_position'        => 'Text',
      'plan_id'              => 'ForeignKey',
      'deposit_amount'       => 'Number',
      'is_activated'         => 'Boolean',
      'join_date'            => 'Date',
      'plan_expires_at'      => 'Date',
      'created_at'           => 'Date',
      'updated_at'           => 'Date',
    );
  }
}
